import {createBrowserRouter, type RouteObject,} from "react-router";
import Home from "../views/Home.tsx";
import Login from "../views/Login.tsx";
import {PersonalCenter} from "../views/PersonalCenter.tsx";
import {ArticleManagement} from "../views/ArticleManagement.tsx";
import ArticleViewer from "../component/ArticleViewer.tsx";
import App from "../App.tsx";

const r: RouteObject[] = [
    {
        path: '/',
        Component: App,
        children: [
            {
                path: 'login',
                Component: Login,
            },
            {
                path: 'homePage',
                Component: Home,

                children: [
                    {
                        path: 'articleManagement',
                        Component: ArticleManagement,
                    }, {
                        path: 'commentManagement',
                        element: <div>评论管理</div>,
                    }, {
                        path: 'personalCenter',
                        Component: PersonalCenter
                    },
                    {
                        path: 'articleViewer/:articleId',
                        Component: ArticleViewer,
                    }
                ]
            }
        ]
    },

]

const router = createBrowserRouter(r);

export default router